//
//  ShowImageView.m
//  花花时尚
//
//  Created by 霍文轩 on 15/8/25.
//  Copyright (c) 2015年 霍文轩. All rights reserved.
//

#import "ShowImageView.h"
#import "ArticleModel.h"

@implementation ShowImageView
-(instancetype)initWithFrame:(CGRect)frame model:(ArticleModel *)model{
    self =  [super initWithFrame:frame];
    if(self){
        self.userInteractionEnabled = YES;
        self.model = model;
        [self createLabelWithTitle:model.title];
    }
    return self;
}
-(void)createLabelWithTitle:(NSString *)title{
    self.label = [[UILabel alloc] initWithFrame:CGRectMake(0, self.frame.size.height-30, self.frame.size.width, 30)];
    [self addSubview:_label];
    _label.backgroundColor = [UIColor colorWithRed:105/255.0 green:106/255.0 blue:107/255.0 alpha:0.5];
    _label.textColor = [UIColor whiteColor];
    _label.text = title;
    _label.font = [UIFont systemFontOfSize:13];
    _label.textAlignment = NSTextAlignmentCenter;
    [_label release];
}
// 进入详情页的代理
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
    [self.delegate enterDetailWithModel:self.model];
}
@end
